package com.wdh.monitor.base;

import com.lmax.disruptor.EventHandler;
import com.wdh.monitor.dto.MonitorDto;
import com.wdh.monitor.service.MonitorMongoService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j(topic = "disruptor.handler")
@AllArgsConstructor
public class MonitorHandler implements EventHandler<MonitorDto> {


    private MonitorMongoService monitorMongoService;


    @Override
    public void onEvent(MonitorDto monitorDto, long sequence, boolean endOfBatch) throws Exception {
        monitorMongoService.insert(monitorDto);
    }
}
